import Data.List
import System.IO
import System.Environment




main = do    
    let list3 = take3 [] ["4","+","3","+","5"]
    print list3

    
    let list3a = take3a [] ["1","+","13","+","5"]
    print list3a

    let list3b = take3b list3  list3a
    print "list3b="
    print list3b
    
   {-

    
    let cc = addstr "3" "7"
    print cc
    
    let cc1 = addstr1 "3" "7"  ["1", "2"]
    print "cc1="
    print cc1
    
    
    
-}
    print "******************:"

take3 ::(Num a, Read a) => [String] -> [String] -> [a ]
take3 _ [] = []
take3 n (x:xs)
    | x `elem` ["+","-", "*", "/"] = take3 (x:n) xs
    | otherwise = read x : take3 n xs    
    
take3a ::[String] -> [String] -> [String ]
take3a _ [] = []
take3a n (x:xs)
    | x `elem` ["+","-", "*", "/"] = x : take3a n xs
    | otherwise = take3a n xs    
    
    
take3b ::(Num a) => [a] -> [String] -> [a]
take3b [x] [] = [x]
take3b [] _ = []
take3b (x:y:ys) ("+":xs) = take3b  (x + y:ys)  xs
take3b (x:y:ys) ("-":xs) = take3b  (x - y:ys)  xs
--take3b x n = x

